//package com.ruoyi.framework.config;
//
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//
//import javax.sql.DataSource;
//
//public class MyBaitsSqlSessionFactory {
//    private MyBaitsSqlSessionFactory() {
//
//    }
//
//    private static final MyBaitsSqlSessionFactory onlyOne = new MyBaitsSqlSessionFactory();
//
//    public static MyBaitsSqlSessionFactory getInstance() {
//        return onlyOne;
//    }
//
//    public SqlSessionFactory sessionFactory(DataSource dataSource,
//                                            String mapper_location,
//                                            String type_aliases_package,
//                                            boolean mapUnderscoreToCamelCase) throws Exception {
//        SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
//        bean.setDataSource(dataSource);
//
//        bean.setVfs(SpringBootVFS.class);
//        //mybatis扫描xml所在位置
//        bean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapper_location));
//        //实体类位置
//        bean.setTypeAliasesPackage(type_aliases_package);
//        //mybatis配置
//        org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();
//        configuration.setMapUnderscoreToCamelCase(mapUnderscoreToCamelCase);
//        bean.setConfiguration(configuration);
//        return bean.getObject();
//    }
//}
